package com.qf.controller;

import org.springframework.security.access.annotation.Secured;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/teacher")
public class TeacherController {

    @Secured("ROLE_teacher")
    @GetMapping("/insert")
    public String insert(){
        return "TEACHER INSERT";
    }

    @PreAuthorize("hasRole('ROLE_student')") //角色
    @GetMapping("/update")
    public String update(){
        return "TEACHER UPDATE";
    }

    @PreAuthorize("hasAnyAuthority('teacher_delete', 'delete')")  //权限
    @GetMapping("/delete")
    public String delete(){
        return "TEACHER DELETE";
    }


    @GetMapping("/select")
    public String select(){
        return "TEACHER SELECT";
    }

}
